import React from 'react';
import { ArrowLeftOutlined } from '@ant-design/icons';
import style from './style.module.less';
import { history } from 'umi';

const KPageHeader = (props: { id?: string; title: string; showBack?: boolean }) => {
  const onBack = () => {
    history.goBack()
  }
  return (
    <div className={style.header} id={props?.id}>
      {(props.showBack === undefined || props.showBack) && (
        <div className={style.icon} onClick={onBack}>
          <ArrowLeftOutlined />
        </div>
      )}

      <div className={style.title}>{props.title}</div>
    </div>
    // <Affix offsetTop={20}>
    //   <div className={style.header} id={props?.id}>
    //     <div className={style.icon} onClick={props.back}>
    //       <ArrowLeftOutlined />
    //     </div>
    //
    //     <div className={style.title}>{props.title}</div>
    //   </div>
    // </Affix>
  );
};

export default KPageHeader;
